package com.fqgj.xjd.user.dao.impl;
import com.fqgj.common.api.Page;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.xjd.user.dao.UserSmsInfoDao;
import com.fqgj.xjd.user.entity.UserSmsInfoEntity;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
* User: frank
* Date: 2020-03-25
* Time: 11:45:00.928
*/

@Repository
public class UserSmsInfoDaoImpl extends AbstractBaseMapper<UserSmsInfoEntity> implements UserSmsInfoDao {

    @Override
    public UserSmsInfoEntity selectByUserCode(String userCode) {
        return getSqlSession().selectOne(getStatement("selectByUserCode"), userCode);
    }

    @Override
    public int deleteByUserCode(String userCode) {
        return getSqlSession().update(getStatement("deleteByUserCode"), userCode);
    }

    @Override
    public List<UserSmsInfoEntity> selectListByPage(Page page, Date endDate) {
        Map param = Maps.newHashMap();
        param.put("page", page);
        param.put("endDate", endDate);
        return getSqlSession().selectList(getStatement("selectListByPage"), param);
    }
}